<?php
// +----------------------------------------------------------------------
// | 青航系统 [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2023-永久 https://www.feifeiyu.club/ All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: 青航-不吃芒果 <1716892803@qq.com>
// +----------------------------------------------------------------------
namespace app\admin\controller;
use think\exception\Jump;
use think\facade\View;

class Comment extends  Common{
    
    
    
    // 数据列表
    public function index(){
        $where['status'] = request()->param('status');
    	$where['content'] = ['like',request()->param('searinfo')];
    	$list = D('comment')->where(formatWhere($where))->order('id DESC')->paginate(15);
        return View('comment/index',['list'=>$list,'searinfo'=>request()->param('searinfo'), 'status'=>request()->param('status')]);
    }
    
    


    // 删除数据
    public function dels() {
    	if (request()->isPost()) {
    	    // 判断是否获取到值
    		if(!input('param.fx'))Jump::error('没有选择项目!!');
    		// 再循环提交过来的值
    		foreach(input('param.fx') as $id) {
               $data = D('comment')->where('id',$id)->delete();  
            }
          }
    	// 判断是否执行成功
    	if($data) {
    		Jump::success("删除成功!!");
    	} else {
    	   Jump::error('删除失败!');
    	}
    }
    
    

    
}